import { configureStore } from '@reduxjs/toolkit'
import homeReducer from './modules/home'
import { shallowEqual, TypedUseSelectorHook, useDispatch, useSelector } from 'react-redux'

const store = configureStore({
  reducer: {
    home: homeReducer
  }
})

type RootStateType = ReturnType<typeof store.getState>
type DispatchType = typeof store.dispatch

export const useAppSelector: TypedUseSelectorHook<RootStateType> = useSelector
export const useAppDispatch: () => DispatchType = useDispatch
export const useAppShallowEqual = shallowEqual

export default store
